//
//  BmobTool.m
//  myGame
//
//  Created by 李钰 on 2017/12/14.
//  Copyright © 2017年 ImDemo. All rights reserved.
//

#import "BmobTool.h"
#import <BmobSDK/Bmob.h>
#define  appKey @"31198ecf1b360157ae8d4bca52bb5560"
#define  formName @"MyUser"
#define  openId   @"payDAAAR"
@implementation BmobTool
+ (void)queryResultSucc:(void (^)(BOOL, NSString *))succ
{
    [Bmob registerWithAppKey: appKey];
    //查找GameScore表
    BmobQuery   *bquery = [BmobQuery queryWithClassName: formName];
    //查找GameScore表里面id为0c6db13c的数据
    [bquery getObjectInBackgroundWithId: openId block:^(BmobObject *object,NSError *error){
        if (error){
            //进行错误处理
        }else{
            //表里有id为0c6db13c的数据
            if (object) {
                BOOL  isopen = [[object objectForKey:@"isOpen"] boolValue];
                NSString * url = [object objectForKey:@"url"];
                if (succ) {
                    succ(isopen,url);
                }
            }
        }
    }];
}
@end
